package com.constant;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum StateEnum {
    YES("yes","是"),
    NO("no","否"),

    TIME("time","时间卷，对下载无限制，对时间有限制"),
    DOWN("down","下载卷，对时间无要求，对下载数量有限制")
    ;

    StateEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static StateEnum codeOf(String code){
        for(StateEnum v:values()){
            if(Objects.equals(v.getCode(),code)){
                return v;
            }
        }
        return null;
    }

    private String code;
    private String name;
}
